import re

text = """001-苹果价格-60
002-橙子价格-70
003-香蕉价格-80"""

# 匹配开头的数字
soup = re.compile(r"^\d+", re.M)
for item in soup.findall(text):
    print(item)

# 匹配末尾的数字
soup = re.compile(r"\d+$", re.M)
for item in soup.findall(text):
    print(item)
